package com.sharding.service.impl;

import com.sharding.config.DS;
import com.sharding.dao.OrderMapper;
import com.sharding.dto.Order;
import com.sharding.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author wl
 * @Description: 订单实现类
 * @date 2018/12/1410:56
 */
@Service(value = "orderService")
public class OrderServiceImpl implements OrderService {

    @Autowired
    OrderMapper orderMapper;

    @Override
    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    @DS("ds2")
    public int insertOrder(Order order) {
        int result = orderMapper.insert(order);
        return result;
    }

    @Override
    @DS("ds1")
    public Object selectAllOrder() {
        return orderMapper.selectAll();
    }
}
